import Cookies from 'js-cookie'

const TokenKey = 'hrsaas-ihrm-token'// 设定一个独一无二的key

const TimeOut = 3600

const expires = new Date(new Date() * 1 + TimeOut * 1000)

export function getToken() {
  return Cookies.get(TokenKey)
}

export function setToken(token) {
  // return Cookies.set(TokenKey, token, { expires: timeStamp + 3600 * 1000 })
  return Cookies.set(TokenKey, token, { expires: 1 })
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}

const TimeKey = 'hrsaas-timestamp-key' // 设置一个独一无二的key

// 获取时间戳
export function getTimeStamp() {
  return Cookies.get(TimeKey)
}
// 设置时间戳
export function setTimeStamp() {
  Cookies.set(TimeKey, Date.now(), { expires })
}
